#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int* selfDividingNumbers(int left, int right, int* returnSize) {
    int i = 0;
    int pos = 0;
    int* p = (int*)malloc(400);
    for (i = left; i <= right; i++)
    {
        int j = i;
        int flag = 1;
        while (j % 10 != 0 && j)
        {
            if (i % (j % 10) != 0)
            {
                flag = -1;
                break;
            }
            j /= 10;
        }
        if (j % 10 == 0)
        {
            flag = -1;
        }
        if (flag == 1)
        {
            *(p + pos) = i;
            pos++;
        }
    }
    *returnSize = pos;
    return p;
}
int main()
{
    int left = 1;
    int right = 22;
    int k = 0;
    selfDividingNumbers(left, right, &k);
    return 0;
}